package Chinese.Education.Identify.service;

import Chinese.Education.Identify.mapper.UserMapper;
import Chinese.Education.Identify.pojo.User;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;

@Service
public class UserService {
    @Resource
    private UserMapper userMapper;
    public Map<String,Object> selectUser(){
        List<User> users = userMapper.selectUser();
         Map<String,Object> map = new HashMap<>();
         map.put("code",200);
         map.put("msg","success");
         map.put("data",users);
         return map;

    };

    public Map<String,Object> selectUserById(String id){
        User user = userMapper.selectUserById(id);
         Map<String,Object> map = new HashMap<>();
         map.put("code",200);
         map.put("msg","success");
         map.put("data",user);
         return map;
    };

    public Map<String,Object> updateById(User user){
        userMapper.updateById(user);
         Map<String,Object> map = new HashMap<>();
         map.put("code",200);
         map.put("msg","success");
         return map;
    }
}
